package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.ExpCtrItemMapper;
import com.csun.cmny.provider.dao.OmcIetypeConfigMapper;
import com.csun.cmny.provider.model.domain.OmcIetypeConfig;
import com.csun.cmny.provider.pojo.ExpCtrItem;
import com.csun.cmny.provider.service.OmcIetypeConfigService;
import com.csun.cmny.provider.vo.OmcChargeConfigVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author chenzheng
 * @description:费用类别配置服务层
 * @date 2019/8/13 16:17
 */
@Slf4j
@Service
public class OmcIetypeConfigServiceImpl extends BaseService<OmcIetypeConfig> implements OmcIetypeConfigService {

    @Resource
    private OmcIetypeConfigMapper omcIetypeConfigMapper;

    /**
     * 根据机构ID查询费用类别配置
     * @param groupId
     * @return
     */
    @Override
    public List<OmcChargeConfigVo> queryALL(Long groupId) {
        return omcIetypeConfigMapper.queryALL(groupId);
    }

    /**
     * 判断费用项目是否存在
     * @param itemId
     * @return
     */
    @Override
    public boolean isChargeItem(Long itemId) {
       Integer n = omcIetypeConfigMapper.selectCountByKey(itemId);
        if(n > 0){
            return true;
        }
        return false;
    }
}
